<!--
 * @FilePath     : /study_code/layui/10-36.html
 * @Description  : dropdown.open('test1')
 * @Date         : 2025-02-20 11:09
 * @Author       : Fang YingGui
 * @LastEditors  : fangyinggui 18715384437@163.com
 * @LastEditTime : 2025-04-09 13:27:39
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="/layui/dist/css/layui.css" />
  </head>
  <body>
    <button id="btn1">手动关闭面板</button>

    <hr />

    <div class="layui-btn-container">
      <button
        class="layui-btn layui-btn-primary demo-dropdown-align"
        lay-options="{align: 'center'}"
      >
        居中对齐
        <i class="layui-icon layui-icon-down layui-font-12"></i>
      </button>
    </div>

    <script src="/layui/dist/layui.js"></script>
    <script src="/dropdown/common.js"></script>
    <script>
      layui.use(function () {
        var dropdown = layui.dropdown,
          $ = layui.$
        // 水平对齐方式
        dropdown.render({
          elem: '.demo-dropdown-align',

          id: 'test1',

          data: data0,
        })

        $('#btn1').on('click', function () {
          console.log('点击按钮 btn1')

          dropdown.open('test1')
        })
      })
    </script>
  </body>
</html>
